import java.util.*;

public class Main {
    static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {
        int anInt = input.nextInt();
        int[][] list = new int[anInt][anInt];
        for (int i = 0; i < anInt; i++) {
            for (int j = 0; j < anInt; j++) {
                list[i][j] = input.nextInt();
            }
        }
        int max = 0,result=0;

        for (int i = 0; i < anInt; i++) {
            max = 0;
            for (int j = 0; j < anInt; j++) {
                if (list[j][i]>max){
                    max = list[j][i];
                }
            }
            result = result+max;
        }

        System.out.println(result);
    }
}
